package com.ndp.fb.mongo.model.autocreatead.robot.user.audience;

import java.io.Serializable;
import java.util.List;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Created by hunk.qin on 2016/6/16.
 */
@Setter
@Getter
@NoArgsConstructor
public class UserAudienceRule implements Serializable {
    public List<ProductAudienceSpec> product_audience_specs;
    public int age_min;
    public int age_max;
    public List<String> genders;
    public List<String> page_types;
    public GeoLocations geo_locations;


    /**
     * set 策略中的差异化的主要指标
     * @param page_types
     * @param location_types
     * @param product_set_id
     */
    public void setMajorValue(List<String> cuntries,String local_product_set_id){
        this.geo_locations.countries = cuntries;
        for (ProductAudienceSpec audience_spec : product_audience_specs) {
            audience_spec.local_product_set_id=local_product_set_id;
        }
    }

   /* public static void main(String[] args) {
        String xx="{\"product_audience_specs\":[{\"product_set_id\":1110706808950304,\"exclusions\":[{\"rule\":{\"event\":{\"eq\":\"Viewed\"}},\"retention_seconds\":432000}],\"inclusions\":[{\"rule\":{\"event\":{\"eq\":\"Viewed\"}},\"retention_seconds\":2592000}]}],\"age_min\":13,\"page_types\":[\"mobilefeed\",\"mobileexternal\"],\"geo_locations\":{\"location_types\":[\"home\",\"recent\"],\"countries\":[\"US\"]},\"age_max\":65}";
        UserAudienceRule userAudienceRule = JSONObject.parseObject(xx, UserAudienceRule.class);
        System.out.println(JSONObject.toJSONString(userAudienceRule));
    }*/
}


